package me.caofeng.enums;

/**
 * Copyright © 2017曹峰. All rights reserved.
 *
 * @Prject: mall
 * @Package: me.caofeng.enums
 * @Description:
 * @Author: 曹峰 blog.caofeng.me
 * @Date: 2017-06-15 16:42
 * @Version: V1.0
 */
public enum Role {
    ADMIN(1, "ADMIN"), MEMBER(2, "MEMBER");

    private int id;
    private String name;

    Role() {
    }

    Role(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static Role getRole(int id) {
        switch (id) {
            case 1:
                return ADMIN;
            case 2:
                return MEMBER;
            default:
                return null;
        }
    }


}
